<%@page import="com.eos.orm.mybatis.model.SalesModel"%>
<%@page import="com.eos.orm.mybatis.model.SysCombo"%>
<%@page import="com.eos.orm.mybatis.model.ActivtyMappSales"%>
<%@page import="com.eos.common.tool.ConstantTool"%>
<%@page import="com.eos.common.tool.DataCacheUtil"%>
<%@page import="java.util.List"%>
<%@page contentType="text/html; charset=utf-8"%>
<%@taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<% 
List<ActivtyMappSales> activitySalesList = (List<ActivtyMappSales>)request.getAttribute("activtySalesList");
List<SysCombo> comboList = (List<SysCombo>)request.getAttribute("comboList");
List<SalesModel> salesList = (List<SalesModel>)request.getAttribute("salesList");
%>
<style>
.page .searchBar label{width: 60px;}
</style>
<!-- 此处加action="employeeCtrl.ctrl"是为了条件查询时仍能显示排序图标 -->
<form id="pagerForm" method="post" action="modelComboList">
	<input type="hidden" name="pageNum" value="${pageNum}" />
	<input type="hidden" name="numPerPage" value="${numPerPage}" />
</form>
<div class="pageHeader">
	<form onsubmit="return navTabSearch(this);" rel="pagerForm" method="post" action="modelComboList">
		<div class="searchBar">
			<input type="hidden" name="numPerPage" value="${numPerPage}" />
			<input type="hidden" name="pageNum" value="${pageNum}" /> 
			<table class="searchContent">
				<tr>
					<td>
						<label style="width: 80px;">活动型号ID:</label>
						<input type="text" name="mappId"  style="float:left;" value="" size="16" />
						<a class="btnLook" width="800" height="500" maxable="false" target="dialog" href="showActivityModel" lookupGroup="" rel="showActivityModel">查找带回</a>
					</td>
					<td>
						<label>销售方式:</label>
						<select class="combox" name="salesId">
							<option value="">-选择销售方式-</option>
						<c:forEach var="s" items="${salesList }">
							<option value="${s.id }" <c:if test="${s.id eq salesId }">selected='selected'</c:if>>${s.salesName }</option>
						</c:forEach>
						</select>
					</td>
					<td>
						<label>套 餐:</label>
						<select name="comboId" class="combox">
							<option value="">-选择套餐-</option>
							<c:forEach var="c" items="${comboList }">
								<option value="${c.id }" <c:if test="${c.id eq comboId }">selected='selected'</c:if>>${c.comboName }</option>
							</c:forEach>
						</select>
					</td>
					<td>
						<label>状 态: </label>
						<select name="dealFlag" class="combox">
							<option value="" ${dealFlag == "" ? "selected='selected'" : "" }>全部</option>
							<option value="0" ${dealFlag == "0" ? "selected='selected'" : "" }>正常</option>
							<option value="1" ${dealFlag == "1" ? "selected='selected'" : "" }>删除</option>
						</select>
					</td>
					<td>
						<div class="subBar">
							<ul>
								<li>
									<div class="buttonActive">
										<div class="buttonContent">
											<button type="submit">
												检索
											</button>
										</div>
									</div>
								</li>
							</ul>
						</div>
					</td>
				</tr>
			</table>
		</div>
	</form>
</div>
<div class="pageContent">
	<div class="panelBar">
		<ul class="toolBar">
			<!--<li>
				<a class="add" style="font-weight: bold;color:#4BBB13;" href="addActivityModelSet?navTabId=addActivity"  target="navTab"  title="新增子活动"><span>新增子活动</span>
				</a>
			</li>
			<li class="line">line</li>
			--><li>
				<a class="edit" style="font-weight: bold;color:#6495ED;" href="editModelSalesSet?activtySalesId={sid_activitySalesId}&navTabId=editModelSalesSet"
					 target="dialog" mask="true" maxable="false" width="480" height="310" rel="editModelSalesSet" title="编 辑型号套餐关系"><span>编 辑型号套餐关系</span>
				</a>
			</li>
			<li class="line">line</li>
			<li>
				<a class="delete" style="font-weight: bold;color:#C1272A;" href="delModelSales?activitySalesId={sid_activitySalesId}"
					target="ajaxTodo" title="确定要删除您所选中的活动吗?"><span>删除型号套餐关系</span>
				</a>
			</li> 
		</ul>
	</div>
	<table class="table" width="100%" layoutH="115">
		<thead>
			<tr>
				<th width="80">序号</th>
				<th>型号套餐ID</th>
				<th>活动型号ID</th>
				<th>套餐</th>
				<th>套餐周期(月)</th>
				<th>销售方式</th>
				<th>销售价格</th>
				<th>是否补贴</th>
				<th>创建时间</th>
				<th>状态</th>
			</tr>
		</thead>
		<tbody>
		    <%if(null != activitySalesList){ 
		    	int i = 1;
		        for(ActivtyMappSales sa : activitySalesList){
		   %>
		   			<tr target="sid_activitySalesId" rel="<%=sa.getId() %>">
					<td><%=i++ %></td>
					<td><%=sa.getId() %></td>
					<td><%=sa.getMappId() %></td>
					<td>
					<%
						if(null != comboList){
							for(SysCombo co : comboList){
								if(co.getId()==sa.getComboId().intValue()){
									out.print(co.getComboName());
									break;
								}
							}
						}
					%>
					</td>
					<td>
						 <%=sa.getComboCycle() %>
					</td>
					<td>
						<%
						 if(null != salesList){
						 	for(SalesModel sm : salesList){
						 		if(sm.getId().intValue() == sa.getSalesId()){
						 			out.print(sm.getSalesName());
						 			break;
						 		}
						 	}
						 }
						%>
					</td>
					<td style="color: #cc3333;">￥<%=sa.getSalesPrice() %></td>
					<td>
					<%
					   if(sa.getIsSubsidy().equals("0")){
					%>
						<a style="color:#f00; text-decoration: none;">否</a>
					<%}else{ %>
						<a style="color:#006400; text-decoration: none;">是</a>
					<%} %>
					</td>
					<td>
					<%=sa.getInsertTime() %>
					</td>
					<td>
						<%if(sa.getDealFlag().equals(ConstantTool.DEAL_FALG_OK)){ %>
						<a style="color:#006400;text-decoration: none;">正常</a>
						<%}else{ %>
						<a style="color:#f00;text-decoration: none;">删除</a>
						<%} %>
					</td>
				</tr>
		   <%}
		   }
		  %>
		</tbody>
	</table>
	<div class="panelBar">
		<div class="pages">
			<span>显示</span>
			<!-- pageNum:1是当更改numPerPage时，使pageNum=1重新开始，否则可能无数据 -->
			<select class="combox" name="numPerPage"
				onchange="navTabPageBreak({numPerPage:this.value, pageNum:1})">
				<option value="15" ${numPerPage==15?'selected':''}>
					15
				</option>
				<option value="20" ${numPerPage==20?'selected':''}>
					20
				</option>
				<option value="25" ${numPerPage==25?'selected':''}>
					25
				</option>
				<option value="50" ${numPerPage==50?'selected':''}>
					50
				</option>
				<option value="100" ${numPerPage==100?'selected':''}>
					100
				</option>
			</select>
			<span>条，共${totalCount }条 </span>
		</div>
		<div class="pagination" targetType="navTab" totalCount="${totalCount }" numPerPage="${numPerPage}" pageNumShown="5" currentPage="${pageNum }"></div>
	</div>
</div>
